﻿using EssentialTools.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace EssentialTools.Controllers
{
    public class HomeController : Controller
    {
        // GET: Home

        private Product[] products =
       {
            new Product {Name="Kayak",Category="Watersports",Price=234M},
            new Product {Name="Lifejacket",Category="Watersports",Price=234M},
            new Product {Name="Soccer ball",Category="Soccer",Price=234M}
        };
        public ActionResult Index()
        {
            LinqValueCalculator calc = new LinqValueCalculator();
            ShoppingCart cart = new ShoppingCart(calc) { Products = products };
            decimal totalValue = cart.CalculateProductTotal();
            return View(totalValue);
        }
    }
}